package com.itheima.sh.web;


import com.itheima.sh.dto.HotelDto;
import com.itheima.sh.dto.Resp;
import com.itheima.sh.pojo.TbHotel;
import com.itheima.sh.service.HotelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api")
public class HotelController {
    @Autowired
    HotelService hotelService;

   @GetMapping ("/query/{page}/{size}")
    public List<TbHotel> queryPageAndSize(@PathVariable Integer page, @PathVariable Integer size){
       return hotelService.queryPageAndSize(page, size);
   }

   @GetMapping("/delete/{id}")
    public Boolean deleteById(@PathVariable Integer id){
       return hotelService.deleteById(id);
   }
   @PostMapping("/update")
   public Boolean update(@RequestBody HotelDto hotelDto){
       return hotelService.updateHotel(hotelDto);
   }
   @PostMapping("/save")
    public  Boolean save(@RequestBody HotelDto hotelDto){
       return hotelService.saveHotel(hotelDto);
   }

}
